Skip to content

#4212 generate teams#4271

Open
Steph375 wants to merge 8 commits into
developfrom
#4212-generate-teams
Open

#4212 generate teams#4271
Steph375 wants to merge 8 commits into
developfrom
#4212-generate-teams

Conversation

@Steph375

@Steph375 Steph375 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Changes

Added teams.factory and teams.process. Then added the process to our dev-seed.ts.

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4212

@Steph375 Steph375 self-assigned this Jun 10, 2026
@Santiordon

Copy link
Copy Markdown
Contributor

Everything else looks great! Just one tiny thing.

Santiordon
Santiordon previously approved these changes Jun 11, 2026

@Santiordon Santiordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm


const leadPool = possibleLeads.filter((user) => user.userId !== head.userId);
const leads = this.faker.helpers.arrayElements(leadPool, this.faker.number.int({ min: 1, max: 3 }));
const teamMembers = this.faker.helpers.arrayElements(members, this.faker.number.int({ min: 8, max: 20 }));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to extract these magic numbers to the top so that it is easily configurable to the devs.

@wavehassman wavehassman self-requested a review June 11, 2026 19:15
const output = await instance.run(depOutputs);

outputs.set(instance.constructor.name, output);
Object.assign(context, output);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This silently clobbers any key that two processes share. The flat context returned at the end has no collision detection. If a future process returns a key that already exists (e.g. both emit organization or teams), the later value wins silently with no error. Either check for collisions before merging, or drop the flat context entirely and let callers use the typed per-process outputs from the Map

throw new Error('TeamProcess could not find a head for a team.');
}

const leadPool = possibleLeads.filter((user) => user.userId !== head.userId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add cross-team exclusion , so the same user cannot end up as a lead on all 20 teams

import { seedTeamConfigs, teamCreateInput } from '../factories/teams.factory.js';
import { SeedProcess } from '../processes/seed-process.js';

const EXPECTED_TEAM_COUNT = 20;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to stay up to date with the length of seedTeamConfigs which makes it annoying to add another team if needed, just use sedTeamConfigs.length

seedTeamConfigs.map((config, index) => {
const head = possibleHeads[index % possibleHeads.length];

if (!head) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to:

if (possibleHeads.length < seedTeamConfigs.length) {
  throw new Error(`Not enough head candidates (${possibleHeads.length}) for ${seedTeamConfigs.length} teams.`);
}

}, {});

const possibleHeads = [...heads, ...admins, ...leadership];
const possibleLeads = [...leadership, ...heads, ...admins];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the distinction between these two and if it's necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Seed Data] - Generate Teams

4 participants